
//  '/api' or'/mock'
const pathPrefix = '/api'
// const pathPrefix = '/mock'


const PubApi = {
  allPage: '/pub/page',
  topPubs: '/pub/topPubs',
  pubDetail: '/pub/detail',
  create: '/pub/create'
}
const UserApi = {
  login: `/login`,
  brief: '/me/brief',
  myMenus: '/me/menus'
}
const AppApi = {
  UserApi,
  PubApi
}
/**
 *
 * @param api
 */
function pathRewrite(api: any) {
  for (const name in api) {
    const url = api[name]
    if (typeof (url) === 'string') {
      api[name] = pathPrefix + url
    }
  }
}
for (const category in AppApi) {
  const api = AppApi[category]
  pathRewrite(api)
}
export default AppApi
